<?php
$loader->requireOnce('includes/Datasource_sql.class.php');
class Icd10 extends ORDataObject {
	var $icd10_id		=	'';
	var $vi_name	=	'';
	var $en_name	=	'';
	var $code			=	'';
	var $icd10_group_id	=	'';
	
	var $_table				=	'icd10';
	var $_key				=	'icd10_id';
	var $_internalName		=	'Icd10';
	var $_foreignKeyList	=	array(
		'icd10_group_id'	=>	'icd10_group'
	);
	
	public function Icd10($db=''){
		parent::ORDataObject($db);
	}
	
	function setup($id = 0) {
        if ($id > 0) {
            $this->set('id',$id);
        }
        $this->populate();
    }

    function populate() {
        parent::populate('icd10_id');
    }
    
    public function getId(){
    	return $this->icd10_id;
    }
    public function getCode(){
    	return $this->code;
    }
	
	public function getObjectbyCode($code){
		$obj	=	ORDataObject::factory('Icd10');
		$sql	=	"select $obj->_key from $obj->_table where code='$code'";
		$res 	= $this->_execute($sql);
		$obj->setup($res->fields[$obj->_key]);
		return $obj;
	}

}
?>